package cn.example.demo.modules.sys.model.entity;

import cn.example.demo.common.secure.datascope.DataScopeType;
import cn.example.demo.common.tools.obj.reflect.Immutable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;

/**
 * <p>
 * 系统角色数据结构
 * </p>
 *
 * @author Lizuxian
 * @create 2021-03-24 23:21
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysRole {
    @Immutable
    @TableId(type = IdType.AUTO)
    private Integer roleId;    // 主键

    @Column(length = 30, nullable = false, unique = true)
    private String role;    // 角色名

    /**
     * 数据范围
     */
    private String dataScope;   // 详情见 DataScopeType

    @Column(columnDefinition = "TEXT")
    private String description; // 描述信息

    @Column(nullable = false)
    private Short status = 1;   // {1:正常, 0:禁用, -1:删除标记}

    @TableField(exist = false)
    private DataScopeType dataScopeType;
}
